﻿using System;
using System.Collections.Generic;
using System.Text;
using Infrastructure.Lib.Core;

namespace CrmSpider.Model
{
    public class ProjectCollection : List<ProjectModel>
    {
        public ProjectCollection(string oriStr)
        {
            var projectStr = oriStr.Substring2("x49_state[\\s\\S]+?\"Values\": ", ",\r", true);
            var projects = projectStr.JsonToModels<List<List<string>>>();

            foreach (var p in projects)
            {
                var pm = new ProjectModel()
                {
                    ProjectName = p[2],
                    CustomerName = p[3],
                    ProjectType = p[4],
                    ProjectBudget = p[5],
                    Ripe = p[6],
                    Node = p[7],
                    DealTime = p[8]
                };
                this.Add(pm);
            }
        }
    }
}
